﻿@if (Model.Contents != null && Model.Contents.Count > 0)
{
	if (Model.Type == PageType.None)
	{
		foreach (var item in Model.Contents)
		{
			@item
		}
	}
	else if (Model.Type == PageType.Column)
	{
		<GridRow>
			@for (int i = 0; i < Model.Contents.Count; i++)
			{
				var span = Model.Spans[i];
				var content = Model.Contents[i];
				<GridCol Span="@span">@content</GridCol>
			}
		</GridRow>
	}
	else if (Model.Type == PageType.Row)
	{
		foreach (var item in Model.Contents)
		{
			<GridRow><GridCol Span="24">@item</GridCol></GridRow>
		}
	}
}

@code {
	[Parameter] public PageModel Model { get; set; }

	protected override void OnInitialized()
	{
		Model.StateChanged = StateHasChanged;
	}
}